<?php

include "config.php";

$path = $_GET['path'];
$mask = $_GET['mask'];
echo "// ".PHP_EOL;
echo "// Autoload '$path', '$mask'".PHP_EOL;
echo "// ".PHP_EOL;
$path = $Config->FileSystem->Root.'/../'.$path;

if( !file_exists($path) )  exit;
	$files = scandir($path);
	natcasesort($files);
	if( count($files) > 2 ) { /* The 2 accounts for . and .. */
		$first = true;
		foreach( $files as $file ) {
		 if( file_exists($path.$file) && $file != '.' && $file != '..' ) {
		if (is_file($path.$file)){
			echo "// ".PHP_EOL;
			echo "// ------------------------ '$file' ------------------------".PHP_EOL;
			echo "// ".PHP_EOL;
			readfile($path.$file);
		}
		}
	}
}
?>
